#include <stdio.h>
#include <stdlib.h>
#include <time.h>


int main(void) {
    const int n=3000000;
    int total=0;
    srand(0);
    for(int i=0;i<n;i++)
    {
        double x=(double)rand()/RAND_MAX;
        double y=(double)rand()/RAND_MAX;
        if(x*x+y*y<=1.0)
            total++;
    }
    double PI=(double)4.0*total/n;
    printf("PI = %.3lf",PI);


    return 0;
}
